package controllers;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Query;

import org.apache.commons.mail.EmailException;

import play.db.jpa.JPA;

import models.BadgeEntity;
import models.BadgeImage;
import models.BadgeType;
import models.Handshake;
import models.Notification;
import models.Handshake.Status;
import models.User;

public class Swe extends BaseController
{   
	static String imageurl=null;

        public static void badges() throws EmailException
    	{	
        	List Imagelist = new ArrayList();

    		BadgeManager badgemanager=new BadgeManager();
    		BadgeImage image = null;
    		User currentuser=badgemanager.getConnectedUser();
    		image=new BadgeImage();
    		BadgeEntity badgeEntity ;
    		
    		Query query = JPA.em().createQuery("from " + BadgeEntity.class.getName() + " where user_id=" + currentuser.id);
    		List<BadgeEntity> badgeEntityList = query.getResultList();
    		badgeEntity=badgeEntityList.get(0);
    		 		
    					if(badgeEntity.getNewbie()!=null){
    					image.setNewbee();
    					Imagelist.add(image);
    								}
    						

		//we should render the list of image
	
    	render(image);
	}
    
    public static void aboutbadge() {
  		render();
      }
    

    
}
